package titt.head;

import titt.head.util.AbstractHead;

public class Content extends AbstractHead implements ContentHead {
		
	public Content(HTTPHead h) {
		super.h = h;
	}
	
	public Content(int length, String content_type, HTTPHead h) {
		this(HeadFactory.createHead(h, new Header("Content-Length", "" + length), new Header("Content-Type", content_type)));
	}
		
	public int getContentLength() {
		return Integer.parseInt(getHeader("Content-Length").getValue());
	}

	public String getContentType() {
		return getHeader("Content-Type").getValue();
	}

	@Override
	public boolean containsContentLength() {
		return getHeader("Content-Length") != null;
	}
}
